import fs from 'node:fs'
import dotenv from 'dotenv'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const __dirname = path.dirname(fileURLToPath(import.meta.url))
dotenv.config()
/*
  !!! 重要 !!!
  请更换：
  RS256 公私钥
  SSL密钥证书（如需https）
*/
export const PRIVATE_KEY = fs.readFileSync(path.resolve(__dirname, './keys/private.key'))
export const PUBLIC_KEY = fs.readFileSync(path.resolve(__dirname, './keys/public.key'))
export const DES_KEY = 'rocyuan'

export const APP_NAME = process.env.APP_NAME
export const APP_HOST = process.env.APP_HOST
export const APP_PORT = Number(process.env.APP_PORT)
export const APP_UPLOAD_BASEURL = process.env.APP_UPLOAD_BASEURL
export const MYSQL_HOST = process.env.MYSQL_HOST
export const MYSQL_PORT = Number(process.env.MYSQL_PORT)
export const MYSQL_DATABASE = process.env.MYSQL_DATABASE
export const MYSQL_USER = process.env.MYSQL_USER
export const MYSQL_PASSWORD = process.env.MYSQL_PASSWORD
export const REDIS_HOST = process.env.REDIS_HOST
export const REDIS_PORT = Number(process.env.REDIS_PORT)
